package ar.edu.itba.it.cg.grupo01.impl.shape.shader;

import java.awt.Color;

import javax.vecmath.Point3f;

import ar.edu.itba.it.cg.grupo01.api.shape.Shape;

public class WoodShader extends PerlinShader {


	public WoodShader(Color noNoise, Color fullNoise) {
		super(noNoise,fullNoise);
	}

	@Override
	protected float getNoise(Shape shape, Point3f intersectionPoint) {
		Point3f uvw = shape.getUVWCoordinates(intersectionPoint);
		
		float result = PerlinNoise.noise3(uvw.x * 0.1f,uvw.y *0.1f,uvw.z*0.1f) * 10;
        return (float) (result - Math.floor(result));
	}

	@Override
	protected float getTurbulenceFunction(Point3f p, float noise, float frequency, int times) {
		float result = noise * 20;
        return (float) (result - Math.floor(result) * Math.pow(0.1f,times));
	}

}
